package com.lp.yuojbackendjudgeservice.judge.codesandbox.impl;


import com.lp.yuojbackendjudgeservice.judge.codesandbox.CodeSandbox;
import com.lp.yuojbackendmodel.codesrandbox.ExecutedCodeRequest;
import com.lp.yuojbackendmodel.codesrandbox.ExecutedCodeResponse;
import com.lp.yuojbackendmodel.codesrandbox.JudgeInfo;
import com.lp.yuojbackendmodel.enums.JudgInfoMessageEnum;
import com.lp.yuojbackendmodel.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * 实例代码沙箱 (为了跑通业务定义的假的代码沙箱)
 */
public class ExampleCodeSandbox implements CodeSandbox {
    @Override
    public ExecutedCodeResponse executeCode(ExecutedCodeRequest executedCodeRequest) {
        List<String> inputList = executedCodeRequest.getInputList();

        ExecutedCodeResponse executedCodeResponse = new ExecutedCodeResponse();
        executedCodeResponse.setOutputList(inputList);
        executedCodeResponse.setMessage("测试执行成功");
        executedCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCESS.getValue());

        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgInfoMessageEnum.ACCEPTED.getText());
        judgeInfo.setTime(100L);
        judgeInfo.setMemory(100L);

        executedCodeResponse.setJudgeInfo(judgeInfo);

        return executedCodeResponse;
    }
}
